package com.probiz.estore.common.model.customer.base;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.customer.Feedback;
import com.probiz.estore.common.model.product.Product;
import com.probiz.estore.common.model.system.AppUser;
import com.probiz.estore.core.model.BaseObject;

/**
 * Feedback Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class FeedbackTbl extends BaseObject implements Serializable {

    protected Integer feedbackId;
	protected String customerName;
	protected String subject;
	protected String message;
	protected String remoteIp;
	protected String address;
	protected String contact;
	protected Short feedbackType;
	protected Date createTime;
	protected Date updateTime;
	protected Short status;
	protected Integer replyCount;
	protected Integer onShowReplyCount;
	protected Short isRead;
	protected AppUser customer;
	protected Product product;
	protected Feedback parent;


	/**
	 * Default Empty Constructor for class Feedback
	 */
	public FeedbackTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class Feedback
	 */
	public FeedbackTbl (
		 Integer in_feedbackId
        ) {
		this.setFeedbackId(in_feedbackId);
    }

	
	
	
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	/**
	 * 	 * @return Integer
     * @hibernate.id column="feedbackId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getFeedbackId() {
		return this.feedbackId;
	}
	
	/**
	 * Set the feedbackId
	 */	
	public void setFeedbackId(Integer aValue) {
		this.feedbackId = aValue;
	}	

	/**
	 * 	 * @return Integer
	 */
	public Integer getProductId() {
		return this.getProduct()==null?null:this.getProduct().getProductId();
	}
	
	/**
	 * Set the productId
	 */	
	public void setProductId(Integer aValue) {
	    if (aValue==null) {
	    	product = null;
	    } else {
	        product = new Product(aValue);
	        product.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	
	
	public AppUser getCustomer() {
		return customer;
	}

	public void setCustomer(AppUser customer) {
		this.customer = customer;
	}

	/**
	 */
	public Integer getCustomerId() {
		return this.getCustomer()==null?null:this.getCustomer().getAppuserId();
	}
	
	/**
	 * Set the managerId
	 */	
	public void setCustomerId(Integer aValue) {
	    if (aValue==null) {
	    	customer = null;
	    } else {
	    	customer = new AppUser(aValue);
	    	customer.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	
	
	
	

	public Feedback getParent() {
		return parent;
	}

	public void setParent(Feedback parent) {
		this.parent = parent;
	}
	
	public Integer getParentId() {
		return this.getParent()==null?null:this.getParent().getFeedbackId();
	}
	
	public void setParentId(Integer aValue) {
	    if (aValue==null) {
	    	parent = null;
	    } else {
	    	parent = new Feedback(aValue);
	    	parent.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="customerName" type="java.lang.String" length="64" not-null="false" unique="false"
	 */
	public String getCustomerName() {
		return this.customerName;
	}
	
	/**
	 * Set the customerName
	 */	
	public void setCustomerName(String aValue) {
		this.customerName = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="subject" type="java.lang.String" length="128" not-null="false" unique="false"
	 */
	public String getSubject() {
		return this.subject;
	}
	
	/**
	 * Set the subject
	 */	
	public void setSubject(String aValue) {
		this.subject = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="message" type="java.lang.String" length="2048" not-null="false" unique="false"
	 */
	public String getMessage() {
		return this.message;
	}
	
	/**
	 * Set the message
	 */	
	public void setMessage(String aValue) {
		this.message = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="remoteIp" type="java.lang.String" length="32" not-null="false" unique="false"
	 */
	public String getRemoteIp() {
		return this.remoteIp;
	}
	
	/**
	 * Set the remoteIp
	 */	
	public void setRemoteIp(String aValue) {
		this.remoteIp = aValue;
	}	

	
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * 联系方式	 * @return String
	 * @hibernate.property column="contact" type="java.lang.String" length="1024" not-null="false" unique="false"
	 */
	public String getContact() {
		return this.contact;
	}
	
	/**
	 * Set the contact
	 */	
	public void setContact(String aValue) {
		this.contact = aValue;
	}	

	/**
	 * 0=抱怨
            1=建议	 * @return Short
	 * @hibernate.property column="feedbackType" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getFeedbackType() {
		return this.feedbackType;
	}
	
	/**
	 * Set the feedbackType
	 */	
	public void setFeedbackType(Short aValue) {
		this.feedbackType = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="createTime" type="java.util.Date" length="19" not-null="false" unique="false"
	 */
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	
	/**
	 * Set the createTime
	 */	
	public void setCreateTime(java.util.Date aValue) {
		this.createTime = aValue;
	}	

	/**
	 * 	 * @return java.util.Date
	 * @hibernate.property column="updateTime" type="java.util.Date" length="19" not-null="false" unique="false"
	 */
	public java.util.Date getUpdateTime() {
		return this.updateTime;
	}
	
	/**
	 * Set the updateTime
	 */	
	public void setUpdateTime(java.util.Date aValue) {
		this.updateTime = aValue;
	}	

	/**
	 * 0=Open
            1=Closed	 * @return Short
	 * @hibernate.property column="status" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getStatus() {
		return this.status;
	}
	
	/**
	 * Set the status
	 */	
	public void setStatus(Short aValue) {
		this.status = aValue;
	}	


	/**
	 * 回复数量	 * @return Integer
	 * @hibernate.property column="replyCount" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getReplyCount() {
		return this.replyCount;
	}
	
	/**
	 * Set the replyCount
	 */	
	public void setReplyCount(Integer aValue) {
		this.replyCount = aValue;
	}	

	/**
	 * 可见的回复数量	 * @return Integer
	 * @hibernate.property column="onShowReplyCount" type="java.lang.Integer" length="10" not-null="false" unique="false"
	 */
	public Integer getOnShowReplyCount() {
		return this.onShowReplyCount;
	}
	
	/**
	 * Set the onShowReplyCount
	 */	
	public void setOnShowReplyCount(Integer aValue) {
		this.onShowReplyCount = aValue;
	}	

	/**
	 * 是否已阅	 * @return Short
	 * @hibernate.property column="isRead" type="java.lang.Short" length="5" not-null="false" unique="false"
	 */
	public Short getIsRead() {
		return this.isRead;
	}
	
	/**
	 * Set the isRead
	 */	
	public void setIsRead(Short aValue) {
		this.isRead = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof FeedbackTbl)) {
			return false;
		}
		FeedbackTbl rhs = (FeedbackTbl) object;
		return new EqualsBuilder()
				.append(this.feedbackId, rhs.feedbackId)
								.append(this.customerName, rhs.customerName)
				.append(this.subject, rhs.subject)
				.append(this.message, rhs.message)
				.append(this.remoteIp, rhs.remoteIp)
				.append(this.contact, rhs.contact)
				.append(this.feedbackType, rhs.feedbackType)
				.append(this.createTime, rhs.createTime)
				.append(this.updateTime, rhs.updateTime)
				.append(this.status, rhs.status)
				.append(this.replyCount, rhs.replyCount)
				.append(this.onShowReplyCount, rhs.onShowReplyCount)
				.append(this.isRead, rhs.isRead)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.feedbackId) 
								.append(this.customerName) 
				.append(this.subject) 
				.append(this.message) 
				.append(this.remoteIp) 
				.append(this.contact) 
				.append(this.feedbackType) 
				.append(this.createTime) 
				.append(this.updateTime) 
				.append(this.status) 
				.append(this.replyCount) 
				.append(this.onShowReplyCount) 
				.append(this.isRead) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("feedbackId", this.feedbackId) 
								.append("customerName", this.customerName) 
				.append("subject", this.subject) 
				.append("message", this.message) 
				.append("remoteIp", this.remoteIp) 
				.append("contact", this.contact) 
				.append("feedbackType", this.feedbackType) 
				.append("createTime", this.createTime) 
				.append("updateTime", this.updateTime) 
				.append("status", this.status) 
				.append("replyCount", this.replyCount) 
				.append("onShowReplyCount", this.onShowReplyCount) 
				.append("isRead", this.isRead) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "feedbackId";
	}
	
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return feedbackId;
	}

}